#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

const int maxn = 2e5 + 10;
const int mod = 998244353;

int main() 
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int t;
    cin >> t;
    while (t--) 
	{
        int n;
        cin >> n;
        vector<int> a(n);
        for (int i = 0; i < n; i++) 
		{
            cin >> a[i];
        }

        int ans = 0;
        while (true) 
		{
            sort(a.begin(), a.end());
            
            int x = 0;
            while (x <= n - 2 && a[x] == 0) 
			{
                x++;
            }

            if (x <= n - 2) 
			{
                a[x]--;
                a[n - 1]--;
                ans++;
            } 
			else 
			{
                break;
            }
            cout << "1" << " " << "2";
        }
        cout << ans << endl;
    }
    return 0;
}

